<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
//前台
Route::namespace('Home')->group(function () {
    Route::get('/', 'HomeController@index');
});
Auth::routes();

Route::get('/home', 'HomeController@index')->name('home');

//后端
Route::namespace('Admin')->prefix('admin')->group(function () {
    Route::get('/login', 'LoginController@showLoginForm');
    Route::post('/login', 'LoginController@login');
    Route::get('/register', 'RegisterController@showRegistrationForm');
    Route::post('/register', 'RegisterController@register');
    Route::middleware('auth:admin')->group(function () {

        Route::get('/index', 'IndexController@index');
        Route::get('/home', 'IndexController@home');
        Route::get('/logout', 'LoginController@logout');

        //商品模块
        Route::resource('goods', 'GoodsController');
        Route::resource('category', 'CategoryController');

    });
});